<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/',[\App\Http\Controllers\Index\IndexController::class, 'index'])->name('home');
Route::get('news',[\App\Http\Controllers\Index\IndexController::class, 'getData']);


Route::get('test', function () {
    echo route('es::query_data', ['keyword' => 1]);
});
Route::group(['as' => 'user::','prefix' => 'user','namespace' => 'App\Http\Controllers\User'],function () {
    Route::get('test','UserController@test');
    Route::get('show-register.html','UserController@showRegister')->name('showRegister');
    Route::post('register','UserController@register');
    Route::post('get_verification','UserController@getVerification');
    Route::get('show-login.html','UserController@showLogin')->name('showLogin');
    Route::post('login','UserController@login');
    Route::get('policy.html','UserController@policy');
    Route::get('question.html','UserController@question')->name('question');
});
//认证接口
Route::group(['as' => 'adminOperate','prefix' => 'admin','namespace' => 'App\Http\Controllers\Admin'],function (){
    Route::get('admin_update_oil_prices','OilPriceController@adminUpdateOilPrice');
    Route::get('oil_sync_prices','OilPriceController@syncPrice');
});

//laravel8的namesapce 必須使用全路径
//http://192.168.149.128/es/get_cluster_status
Route::group(['as'=> 'es::','prefix'=> 'es','namespace'=> 'App\Http\Controllers\Es'],function () {
    Route::get('get_cluster_status','TestController@getClusterStatus');
    Route::get('create_mapping','TestController@putMapping');
    Route::get('get_mapping','TestController@getMapping');
    Route::get('explain','TestController@allocationExplain');
    Route::get('bulk_data','TestController@insertDataBulk');
    Route::get('get_single_data/{id}','TestController@getSingleData');
    Route::get('update_single_data/{id}/','TestController@singleUpdate');
    Route::get('query_data','TestController@queryData')->name('query_data');
});
Route::group(['as' => 'group::','prefix' => 'group','namespace' => 'App\Http\Controllers\Group'],function (){
    Route::get('shopping','GroupController@shoppingIndex');
});



